package com.hsylient.javase.chapter12.demo02;

import lombok.SneakyThrows;

import java.io.InputStream;
import java.net.Socket;

public class Client {

    @SneakyThrows
    public static void main(String[] args) {
        Socket localhost = new Socket("localhost", 9000);
        InputStream inputStream = localhost.getInputStream();
        byte[] bytes = new byte[8];
        int readLen = inputStream.read(bytes);
        String acceptMessage = new String(bytes, 0, readLen);
        System.out.println(acceptMessage);
        inputStream.close();
        localhost.close();
    }
}
